#syntax=docker/dockerfile:1
FROM openjdk:17-jdk-alpine
ARG JAR_FILE
ENV APP_DIR=/app \
    JAVA_OPTS="" \
    PROFILE=dev

WORKDIR $APP_DIR
RUN apk add --no-cache bash

COPY jenkins/app/config config
COPY jenkins/app/liscense liscense
COPY ${JAR_FILE} app.jar

ENV JAVA_OPTS="-Dspring.profiles.active=$PROFILE -Dfile.encoding=UTF-8 -Xms512M -Xmx512M -XX:+HeapDumpOnOutOfMemoryError"

EXPOSE 8581

ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
